


//
//  PMineResumeEducationViewController.m
//  Btpin
//
//  Created by Vic on 2019/3/24.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "PMineResumeEducationViewController.h"
#import <Photos/Photos.h>
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVMediaFormat.h>
#import "ImageCollectionViewCell.h"

@interface PMineResumeEducationViewController ()<TimeSelectPickerViewDelegate, PSSingleRowViewDelegate, ImageCollectionViewCellDelegate, UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UICollectionViewDelegate, UICollectionViewDataSource, UITextFieldDelegate>
{
    BaseNetManager *netManager;
    
    UIScrollView *bottomScrollView;
    UICollectionView *upDateImgCollectionView;
    
    NSString *educationID;
}
@property (nonatomic, strong) PSCell *schoolCell;
@property (nonatomic, strong) PSCell *professionCell;
@property (nonatomic, strong) PSCell *startTimeCell;
@property (nonatomic, strong) PSCell *endTimeCell;
@property (nonatomic, strong) PSCell *educationCell;
@property (nonatomic, strong) TimeSelectPickerView *startTimePickerView;
@property (nonatomic, strong) TimeSelectPickerView *endTimePickerView;
@property (nonatomic, strong) PSSingleRowView *educationPickerView;
@property (nonatomic, strong) PSSingleRowView *updateImgPickerView;
@end

@implementation PMineResumeEducationViewController

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    if (self.startTimePickerView) {
        self.startTimePickerView.hidden = YES;
    }
    if (self.endTimePickerView) {
        self.endTimePickerView.hidden = YES;
    }
    if (self.educationPickerView) {
        self.educationPickerView.hidden = YES;
    }
    if (self.updateImgPickerView) {
        self.updateImgPickerView.hidden = YES;
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"教育经历";
    netManager = [BaseNetManager sharedManager];
    
    if (self.type == AddOrEditTypeOfEdit) {
        [self loadData];
    } else {
        self.model = [[PMineResumeEducationInfoModel alloc] init];
        [self initUI];
    }
}
- (void)loadData {
    SVPHUDShow;
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithCapacity:0];
    dic = [UIToolsControl getPublicParameter];
    [dic setObject:self.model.info_id forKey:@"info_id"];
    
    [BaseNetManager requestWithMethod:POST path:PersonMine_GetEduInfo_URL params:dic successBlock:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"] integerValue] == 2000) {
            id data = responseObject[@"data"];
            if ([data isKindOfClass:[NSArray class]]) {
                self.model = [[PMineResumeEducationInfoModel alloc] init];
                [self.model setValuesForKeysWithDictionary:data[0]];
            } else if ([data isKindOfClass:[NSDictionary class]]) {
                self.model = [[PMineResumeEducationInfoModel alloc] init];
                [self.model setValuesForKeysWithDictionary:data];
            }
            
            self->educationID = self.model.education;
            [self initUI];
            SVPHUDDismiss;
        } else {
            SVPHUDError(responseObject[@"msg"]);
        }
    } failurBlock:^(NSError * _Nonnull error) {
        [self loadData];
    }];
}
- (void)initUI {
    UIButton *okBtn = [UIToolsControl initButtonWithFrame:CGRectMake(WIDTH-50*Scale, HeightOfStatusBar+3*Scale, 50*Scale, 36) imageName:nil target:self action:@selector(okBtnTap) title:((self.type == AddOrEditTypeOfAdd)?@"确定":@"保存") titleColor:THEMECOLOR_OF_ORANGE];
    okBtn.titleLabel.font = Font(Font_15);
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:okBtn];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    bottomScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-SIMEmojKeyBoardkBottomNOSafeArea_Height-HeightOfStatusBarAndNavigationBar)];
    [self.view addSubview:bottomScrollView];
    
    __weak __typeof(self)weakSelf = self;
    self.startTimePickerView = [[TimeSelectPickerView alloc] initWithTarget:self time:nil timeSelectPickerType:TimeSelectPickerTypeOfWorking dateFormat:nil];
    self.startTimePickerView.hidden = YES;
    self.endTimePickerView = [[TimeSelectPickerView alloc] initWithTarget:self time:nil timeSelectPickerType:TimeSelectPickerTypeOfWorking dateFormat:nil];
    self.endTimePickerView.hidden = YES;
    self.educationPickerView = [[PSSingleRowView alloc] initWithData:[DataToolsControl sharedManager].allCategoryInfoModel.educationArray target:self];
    self.educationPickerView.hidden = YES;
    NSMutableArray *headerArray = [NSMutableArray arrayWithCapacity:0];
    PublicCategoryElementModel *model1 = [[PublicCategoryElementModel alloc] init];
    [model1 setValuesForKeysWithDictionary:@{@"id":@"0", @"name":@"拍摄"}];
    [headerArray addObject:model1];
    PublicCategoryElementModel *model2 = [[PublicCategoryElementModel alloc] init];
    [model2 setValuesForKeysWithDictionary:@{@"id":@"1", @"name":@"相册"}];
    [headerArray addObject:model2];
    self.updateImgPickerView = [[PSSingleRowView alloc] initWithData:headerArray target:self];
    self.updateImgPickerView.hidden = YES;
    
    self.schoolCell = [[PSCell alloc] initWithFrame:CGRectMake(30*Scale, 15*Scale, WIDTH-60*Scale, PSCellHeight) title:@"毕业院校" text:((self.model&&self.model.school.length)?self.model.school:nil) placeholder:@"请输入您所毕业院校的名称" cellType:PSCellTypeOfWriteonly];
    self.schoolCell.textField.delegate = self;
    [bottomScrollView addSubview:self.schoolCell];
    
    self.professionCell = [[PSCell alloc] initWithFrame:CGRectMake(30*Scale, EndY(self.schoolCell), WIDTH-60*Scale, PSCellHeight) title:@"专业" text:((self.model&&self.model.speciality.length)?self.model.speciality:nil) placeholder:@"请输入" cellType:PSCellTypeOfWriteonly];
    self.professionCell.textField.delegate = self;
    [bottomScrollView addSubview:self.professionCell];
    
    self.startTimeCell = [[PSCell alloc] initWithFrame:CGRectMake(30*Scale, EndY(self.professionCell), WIDTH-60*Scale, PSCellHeight) title:@"开始时间" text:((self.type == AddOrEditTypeOfEdit)?self.model.start_date:nil) placeholder:@"年/月/日" cellType:PSCellTypeOfIndicator];
    self.startTimeCell.tap = ^{
        __strong __typeof(weakSelf)strongSelf = weakSelf;
        [UIToolsControl resignFirstResponderForTextFieldArray:@[strongSelf.schoolCell.textField, strongSelf.professionCell.textField]];
//        strongSelf.startTimePickerView.hidden = NO;
        [strongSelf chooseYearAndMonth];
    };
    [bottomScrollView addSubview:self.startTimeCell];
    
    self.endTimeCell = [[PSCell alloc] initWithFrame:CGRectMake(30*Scale, EndY(self.startTimeCell), WIDTH-60*Scale, PSCellHeight) title:@"结束时间" text:((self.type == AddOrEditTypeOfEdit)?self.model.end_date:nil) placeholder:@"年/月/日" cellType:PSCellTypeOfIndicator];
    self.endTimeCell.tap = ^{
        __strong __typeof(weakSelf)strongSelf = weakSelf;
        [UIToolsControl resignFirstResponderForTextFieldArray:@[strongSelf.schoolCell.textField, strongSelf.professionCell.textField]];
//        strongSelf.endTimePickerView.hidden = NO;
        [strongSelf chooseYearMonthAndNow];
    };
    [bottomScrollView addSubview:self.endTimeCell];
    
    self.educationCell = [[PSCell alloc] initWithFrame:CGRectMake(30*Scale, EndY(self.endTimeCell), WIDTH-60*Scale, PSCellHeight) title:@"学历" text:((self.type == AddOrEditTypeOfEdit)?self.model.education_cn:nil) placeholder:@"请选择" cellType:PSCellTypeOfIndicator];
    self.educationCell.tap = ^{
        __strong __typeof(weakSelf)strongSelf = weakSelf;
        [UIToolsControl resignFirstResponderForTextFieldArray:@[strongSelf.schoolCell.textField, strongSelf.professionCell.textField]];
        strongSelf.educationPickerView.hidden = NO;
    };
    [bottomScrollView addSubview:self.educationCell];
    
    UILabel *topLbl = [UIToolsControl initLabelWithFrame:CGRectMake(30*Scale, EndY(self.educationCell)+10*Scale, 200, 40*Scale) text:@"证书上传：" textColor:THEMECOLOR_OF_TEXT_333333 font:Font_13];
    [bottomScrollView addSubview:topLbl];
    
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    layout.minimumInteritemSpacing = 0;
    layout.minimumLineSpacing = 10*Scale;
    layout.itemSize = CGSizeMake(110*Scale, 110*Scale);
    upDateImgCollectionView = [UIToolsControl initCollectionViewWithFrame:CGRectMake(30*Scale, EndY(topLbl), WIDTH-60*Scale, 110*Scale) target:self collectionViewLayout:layout collectionViewCellID:isCellID registerClass:[ImageCollectionViewCell class]];
    [bottomScrollView addSubview:upDateImgCollectionView];
    upDateImgCollectionView.backgroundColor = COLOR_OF_WHITE;
    
    
    UILabel *bottomLbl = [UIToolsControl initLabelWithFrame:CGRectMake(30*Scale, EndY(upDateImgCollectionView), WIDTH-39*Scale, 50*Scale) text:@"提示：学历证书认证的好处：1、视频面试特权。2、简历赚钱。3、去公司面试可以免带学历证书。" textColor:THEMECOLOR_OF_ORANGE font:Font_13];
    bottomLbl.numberOfLines = 0;
    bottomLbl.lineBreakMode = NSLineBreakByWordWrapping;
    [bottomScrollView addSubview:bottomLbl];
    
    if (self.type == AddOrEditTypeOfEdit) {
        UIButton *deleteBtn = [UIToolsControl initButtonWithFrame:CGRectMake(40*Scale, EndY(bottomLbl)+30*Scale, WIDTH-80*Scale, 40*Scale) imageName:nil target:self action:@selector(deleteBtnTap) title:@"删除此条学历" titleColor:COLOR_OF_WHITE];
        deleteBtn.backgroundColor = THEMECOLOR_OF_RED;
        deleteBtn.layer.cornerRadius = 20*Scale;
        deleteBtn.layer.masksToBounds = YES;
        deleteBtn.titleLabel.font = Font(Font_17);
        [bottomScrollView addSubview:deleteBtn];
        
        bottomScrollView.contentSize = CGSizeMake(0, EndY(deleteBtn)+20*Scale);
    } else {
        bottomScrollView.contentSize = CGSizeMake(0, EndY(bottomLbl)+20*Scale);
    }
}
- (void)okBtnTap {
    [UIToolsControl resignFirstResponderForTextFieldArray:@[self.schoolCell.textField, self.professionCell.textField]];
    
    if (self.schoolCell.textField.text.length == 0) {
        SVPHUDError(SchoolAlertText);
        return;
    }
    if (self.professionCell.textField.text.length == 0) {
        SVPHUDError(SpecialityAlertText);
        return;
    }
    if (self.startTimeCell.textField.text.length == 0) {
        SVPHUDError(StartTimeOKAlertText);
        return;
    }
    if (self.endTimeCell.textField.text.length == 0) {
        SVPHUDError(EndTimeOKAlertText);
        return;
    }
    if (self.educationCell.textField.text.length == 0) {
        SVPHUDError(EducationAlertText);
        return;
    }
    if (![UIToolsControl comparisonLatterStarTime:self.startTimeCell.textField.text endTime:self.endTimeCell.textField.text]) {
        SVPHUDError(@"结束时间必须大于起始时间");
        return;
    }
    
    SVPHUDShow;
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithCapacity:0];
    dic = [UIToolsControl getPublicParameter];
    [dic setObject:((self.model && self.model.info_id.length)?self.model.info_id:@"") forKey:@"info_id"];
    if ([self.endTimeCell.textField.text isEqualToString:@"至今"]) {
        dic[@"end_date"] = @"";
    } else {
//        [dic setObject:((endTimeCell.textField.text.length)?((endTimeCell.textField.text.length<=7)?endTimeCell.textField.text:[endTimeCell.textField.text substringToIndex:7]):@"") forKey:@"end_date"];
        [dic setObject:self.endTimeCell.textField.text forKey:@"end_date"];
    }
//    [dic setObject:((endTimeCell.textField.text.length)?((endTimeCell.textField.text.length<=7)?endTimeCell.textField.text:[endTimeCell.textField.text substringToIndex:7]):@"") forKey:@"end_date"];
    [dic setObject:self.startTimeCell.textField.text forKey:@"start_date"];
    [dic setObject:self.schoolCell.textField.text forKey:@"school"];
    [dic setObject:self.professionCell.textField.text forKey:@"speciality"];
    [dic setObject:educationID forKey:@"education"];
    NSMutableArray *imgArr = [NSMutableArray arrayWithCapacity:0];
    if (self.model.imagesArray && self.model.imagesArray.count) {
        for (ImageModel *mmodel in self.model.imagesArray) {
            [imgArr addObject:@{@"id":mmodel.id, @"img":mmodel.img}];
        }
    }
    [dic setObject:imgArr forKey:@"images"];
    
    [BaseNetManager requestWithMethod:POST path:PersonMine_SaveEduInfo_URL params:dic successBlock:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"] integerValue] == 2000) {
            SVPHUDSuccess(responseObject[@"msg"]);
            
            if (self.delegate && [self.delegate respondsToSelector:@selector(pMineResumeEducationViewControllerBackRefresh:)]) {
                [self.delegate pMineResumeEducationViewControllerBackRefresh:YES];
            }
            
            [self performSelector:@selector(delayClick) withObject:nil afterDelay:0.5];
        } else {
            SVPHUDError(responseObject[@"msg"]);
        }
    } failurBlock:^(NSError * _Nonnull error) {
        SVPHUDError(NetErrorAlertText);
    }];
}
- (void)delayClick {
    [self.navigationController popViewControllerAnimated:YES];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    if (self.model && self.model.imagesArray.count) {
        return self.model.imagesArray.count+1;
    }
    return 1;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    ImageCollectionViewCell *cell = (ImageCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:isCellID forIndexPath:indexPath];
    cell.delegate = self;
    
    if (self.model && self.model.imagesArray.count) {
        if (indexPath.row == (self.model.imagesArray.count)) {
            [cell reloadData:nil indexPath:indexPath lastObject:YES hiddenAudit:NO];
        } else {
            ImageModel *model = self.model.imagesArray[indexPath.row];
            [cell reloadData:model indexPath:indexPath lastObject:NO hiddenAudit:NO];
        }
    } else {
        [cell reloadData:nil indexPath:indexPath lastObject:YES hiddenAudit:NO];
    }
    
    return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    [collectionView deselectItemAtIndexPath:indexPath animated:YES];
    if (self.model && self.model.imagesArray.count) {
        if (indexPath.row == (self.model.imagesArray.count)) {
            self.updateImgPickerView.hidden = NO;
        } else { // 后面要不要放大图？？
            
        }
    } else {
        self.updateImgPickerView.hidden = NO;
    }
}
- (void)imageCollectionViewCellDeleteTap:(NSIndexPath *)indexPath {
    NSLog(@"删除");
    [self.model.imagesArray removeObjectAtIndex:indexPath.row];
    [upDateImgCollectionView reloadData];
}
- (void)imageCollectionViewCellImgTap:(NSIndexPath *)indexPath {
    self.updateImgPickerView.hidden = NO;
}
- (void)psSingleRowViewCancel:(PSSingleRowView *)psSingleRowView {
    psSingleRowView.hidden = YES;
}
- (void)psSingleRowViewOk:(PublicCategoryElementModel *)model PSSingleRowView:(PSSingleRowView *)psSingleRowView {
    psSingleRowView.hidden = YES;
    if (psSingleRowView == self.educationPickerView) {
        self.educationCell.textField.text = model.name;
        educationID = model.id;
    } else if (psSingleRowView == self.updateImgPickerView) {
        if ([model.id integerValue] == 1) { // 相册
            [self openPhotoLibrary];
        } else { // 拍摄
            [self openCamera];
        }
    }
}
- (void)timeSelectPickerViewCancel:(TimeSelectPickerView *)timeSelectPickerView {
    timeSelectPickerView.hidden = YES;
}
- (void)timeSelectPickerViewOK:(NSString *)selectText timeSelectPickerView:(TimeSelectPickerView *)timeSelectPickerView {
    timeSelectPickerView.hidden = YES;
    if (timeSelectPickerView == self.startTimePickerView) {
        self.startTimeCell.textField.text = selectText;
    } else if (timeSelectPickerView == self.endTimePickerView) {
        self.endTimeCell.textField.text = selectText;
    }
}
- (void)openCamera {
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    
    AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if (status == AVAuthorizationStatusRestricted || status == AVAuthorizationStatusDenied) { // 无权限
        CustomView *alertView = [[CustomView alloc] initWithTitle:@"相机权限未开启" message:@"相机权限未开启，请进入系统【设置】>【隐私】>【相机】中打开开关,开启相机功能" prompt:nil sureBtn:@"确定" cancleBtn:@"取消" size:170];
        alertView.resultIndex = ^(NSInteger index) { //回调---处理一系列动作
            if (index == 2) {
                [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
            }
        };
        [alertView showXLAlertView];
    } else { // 有权限
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        [self presentViewController:picker animated:YES completion:nil];
    }
}
- (void)openPhotoLibrary {
    PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
    if (status == PHAuthorizationStatusRestricted || status == PHAuthorizationStatusDenied) { // 无权限
        CustomView *alertView = [[CustomView alloc] initWithTitle:@"相册权限未开启" message:@"相册权限未开启，请进入系统【设置】>【隐私】>【相册】中打开开关,开启相册功能" prompt:nil sureBtn:@"确定" cancleBtn:@"取消" size:170];
        alertView.resultIndex = ^(NSInteger index) { //回调---处理一系列动作
            if (index == 2) {
                [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
            }
        };
        [alertView showXLAlertView];
    } else { // 有权限
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.allowsEditing = NO;
        imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        imagePicker.delegate = self;
        imagePicker.navigationBar.translucent = NO;
        imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;
        [self presentViewController:imagePicker animated:YES completion:^{
            NSLog(@"打开相册");
        }];
    }
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info {
    NSLog(@"finish..");
    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    SVPHUDShow;
    [DataToolsControl uploadImgType:UploadImgTypeOfEduCert image:image successBlock:^(NSDictionary *responseObject) {
        SVPHUDDismiss;
        if ([responseObject[@"code"] integerValue] == 2000) {
            id data = responseObject[@"data"];
            ImageModel *model = [[ImageModel alloc] init];
            model.img = data[@"url"];
            model.id = @"0";
            if (self.model && self.model.imagesArray) {
                [self.model.imagesArray addObject:model];
            } else {
                self.model = [[PMineResumeEducationInfoModel alloc] init];
                self.model.imagesArray = [NSMutableArray arrayWithCapacity:0];
                [self.model.imagesArray addObject:model];
            }
            [self->upDateImgCollectionView reloadData];
        } else {
            SVPHUDError(responseObject[@"msg"]);
        }
    } failurBlock:^(NSError *error) {
        SVPHUDError(@"上传失败，请重新操作");
    }];
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)deleteBtnTap {
    CustomView *alertView = [[CustomView alloc] initWithTitle:@"提示" message:@"确认删除此条学历" prompt:nil sureBtn:@"确定" cancleBtn:@"取消" size:150];
    alertView.resultIndex = ^(NSInteger index){
        //回调---处理一系列动作
        if (index == 2) {
            [self deleteClick];
        }
    };
    [alertView showXLAlertView];
}
- (void)deleteClick {
    SVPHUDShow;
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithCapacity:0];
    dic = [UIToolsControl getPublicParameter];
    [dic setObject:self.model.info_id forKey:@"info_id"];
    
    [BaseNetManager requestWithMethod:POST path:PersonMine_DelEduInfo_URL params:dic successBlock:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"] integerValue] == 2000) {
            SVPHUDSuccess(responseObject[@"msg"]);
            
            if (self.delegate && [self.delegate respondsToSelector:@selector(pMineResumeEducationViewControllerBackRefresh:)]) {
                [self.delegate pMineResumeEducationViewControllerBackRefresh:YES];
            }
            
            [self performSelector:@selector(delayClick) withObject:nil afterDelay:0.5];
        } else {
            SVPHUDError(responseObject[@"msg"]);
        }
    } failurBlock:^(NSError * _Nonnull error) {
        SVPHUDError(NetErrorAlertText);
    }];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [UIToolsControl resignFirstResponderForTextFieldArray:@[self.schoolCell.textField, self.professionCell.textField]];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

#pragma mark-- Action
- (void)chooseYearAndMonth{
    __weak typeof(self)weakSelf = self;
    [LYSelectYearMonthPicker actionPickerMinDate:1800 minMonth:1 isShowCurrent:NO sureBlock:^(NSString *selectDate) {
        //年月 例如：2019-03
        [weakSelf showStartTime:selectDate];
    }];
}

- (void)showStartTime:(NSString *)selectDate{
    self.startTimeCell.textField.text = selectDate;
}

- (void)chooseYearMonthAndNow{
    __weak typeof(self)weakSelf = self;
    [LYSelectYearMonthPicker actionPickerMinDate:1800 minMonth:1 isShowCurrent:YES sureBlock:^(NSString *selectDate) {
        NSString *date = selectDate;
        if ([date isEqualToString:@"0-00"]) {
            //至今 后台传空
            [weakSelf showEndTime:@"至今"];
        }else{
            //年月 例如：2019-03
            [weakSelf showEndTime:selectDate];
        }
    }];
}

- (void)showEndTime:(NSString *)selectDate{
    self.endTimeCell.textField.text = selectDate;
}


@end
